﻿using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.Common;
using HumanManagement.BusinessObjects;
using HumanManagement.DataAccess;

namespace HumanManagement.BusinessLogic
{
	public class DocumentItemCategoryBL
	{

		#region ***** Init Methods ***** 
		DocumentItemCategoryDA objDocumentItemCategoryDA;
		public DocumentItemCategoryBL()
		{
			objDocumentItemCategoryDA = new DocumentItemCategoryDA();
		}
		#endregion

		#region ***** Get Methods ***** 
		/// <summary>
		/// Get DocumentItemCategory by id
		/// </summary>
		/// <param name="id">ID</param>
		/// <returns>DocumentItemCategory</returns>
		public DocumentItemCategory GetByID(int id)
		{
			return objDocumentItemCategoryDA.GetByID(id);
		}

		/// <summary>
		/// Get all of DocumentItemCategory
		/// </summary>
		/// <returns>List<<DocumentItemCategory>></returns>
		public List<DocumentItemCategory> GetList()
		{
			string cacheName = "lstDocumentItemCategory";
			if( ServerCache.Get(cacheName) == null )
			{
				ServerCache.Insert(cacheName, objDocumentItemCategoryDA.GetList(), "DocumentItemCategory");
			}
			return (List<DocumentItemCategory>) ServerCache.Get(cacheName);
		}

		/// <summary>
		/// Get DataSet of DocumentItemCategory
		/// </summary>
		/// <returns>DataSet</returns>
		public DataSet GetDataSet()
		{
			string cacheName = "dsDocumentItemCategory";
			if( ServerCache.Get(cacheName) == null )
			{
				ServerCache.Insert(cacheName, objDocumentItemCategoryDA.GetDataSet(), "DocumentItemCategory");
			}
			return (DataSet) ServerCache.Get(cacheName);
		}


		/// <summary>
		/// Get all of DocumentItemCategory paged
		/// </summary>
		/// <param name="recperpage">recperpage</param>
		/// <param name="pageindex">pageindex</param>
		/// <returns>List<<DocumentItemCategory>></returns>
		public List<DocumentItemCategory> GetListPaged(int recperpage, int pageindex)
		{
			return objDocumentItemCategoryDA.GetListPaged(recperpage, pageindex);
		}

		/// <summary>
		/// Get DataSet of DocumentItemCategory paged
		/// </summary>
		/// <param name="recperpage">recperpage</param>
		/// <param name="pageindex">pageindex</param>
		/// <returns>DataSet</returns>
		public DataSet GetDataSetPaged(int recperpage, int pageindex)
		{
			return objDocumentItemCategoryDA.GetDataSetPaged(recperpage, pageindex);
		}





		#endregion

		#region ***** Add Update Delete Methods ***** 
		/// <summary>
		/// Add a new DocumentItemCategory within DocumentItemCategory database table
		/// </summary>
		/// <param name="obj_documentitemcategory">DocumentItemCategory</param>
		/// <returns>key of table</returns>
		public int Add(DocumentItemCategory obj_documentitemcategory)
		{
			ServerCache.Remove("DocumentItemCategory", true);
			return objDocumentItemCategoryDA.Add(obj_documentitemcategory);
		}

		/// <summary>
		/// updates the specified DocumentItemCategory
		/// </summary>
		/// <param name="obj_documentitemcategory">DocumentItemCategory</param>
		/// <returns></returns>
		public void Update(DocumentItemCategory obj_documentitemcategory)
		{
			ServerCache.Remove("DocumentItemCategory", true);
			objDocumentItemCategoryDA.Update(obj_documentitemcategory);
		}

		/// <summary>
		/// Delete the specified DocumentItemCategory
		/// </summary>
		/// <param name="id">ID</param>
		/// <returns></returns>
		public void Delete(int id)
		{
			ServerCache.Remove("DocumentItemCategory", true);
			objDocumentItemCategoryDA.Delete(id);
		}
		#endregion
	}
}
